package com.example.State;

/**
 * 状态模式
 * https://www.runoob.com/design-pattern/state-pattern.html
 */
public class app {
    public static void main(String[] args) {
        Context ctx = new Context();

        new StartState().doAction(ctx);
        System.out.println(ctx.getState().toString());

        new StopState().doAction(ctx);
        System.out.println(ctx.getState().toString());

        // output:
        //     Current state: start
        //     Start state
        //     Current state: stop
        //     Stop state
    }
}
